import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { DiseaseTypeVO, DiseaseTypeQuery, DiseaseTypeForm } from "./types";

/**
 * 所有类型
 * @param queryParams
 */
export function listDiseaseType(
  queryParams?: DiseaseTypeQuery
): AxiosPromise<DiseaseTypeVO[]> {
  return request({
    url: "buss/disease-type/list",
    method: "get",
    params: queryParams,
  });
}

/**
 * 所有类型(树结构)
 * @param queryParams
 */
export function treeDiseaseType(
  queryParams?: DiseaseTypeQuery
): AxiosPromise<DiseaseTypeVO[]> {
  return request({
    url: "buss/disease-type/tree",
    method: "get",
    params: queryParams,
  });
}

/**
 * 获取类型详情
 *
 * @param userId
 */
export function getDiseaseTypeForm(id: string): AxiosPromise<DiseaseTypeForm> {
  return request({
    url: `buss/disease-type/one/${id}`,
    method: "get",
  });
}

/**
 * 新增
 *
 * @param data
 */
export function saveDiseaseType(data: DiseaseTypeForm) {
  return request({
    url: "buss/disease-type/save",
    method: "post",
    data,
  });
}

/**
 * 删除
 */
export function deleteDiseaseType(ids: string[]) {
  return request({
    url: "buss/disease-type/del",
    method: "post",
    data: ids,
  });
}
